<template>
  <div class="settings">
    <van-nav-bar safe-area-inset-top placeholder :title="$t('SuperSetting')" left-arrow fixed @click-left="onClickLeft" />
    <van-pull-refresh v-model="isLoading" :pulling-text="$t('PullingText')" :loosing-text="$t('PullingText')" :success-text="$t('refreshSuccee')" @refresh="onRefresh">
      <van-collapse class="marginTop15" v-model="activeNames">
        <van-collapse-item :title="$t('ActivePowerLimit')" name="1">
          <pfLockInPointVue :setName="$t('ActivePowerLimit')" :setUntil="'%'" :setMin="0" :setMax="100" :valName="'ActivePowerLimitValue'" :subOption="'ActivePowerLimit'" :setValue.sync="ActivePowerLimitValue"></pfLockInPointVue>
        </van-collapse-item>
        <van-collapse-item :title="$t('Reset')" name="2">
          <resetINVEnergyVue :setName="$t('ResetInverterE2PROM')" :valName="'ResetInverterE2PROMValue'" :subOption="'ResetInverterE2PROM'"></resetINVEnergyVue>
        </van-collapse-item>
      </van-collapse>
    </van-pull-refresh>
  </div>
</template>

<script>
import pfLockInPointVue from '../../../components/PfLockInPoint/BDPfLockInPoint'
import resetINVEnergyVue from '../../../components/ResetINVEnergy/BDResetINVEnergy'

export default {
  components:{
    pfLockInPointVue,
    resetINVEnergyVue
  },
  data(){
    return {
      isLoading:false,
      activeNames:[],
      ActivePowerLimitValue:''
    }
  },
  methods: {
    onClickLeft(){
      this.$router.push({path:'/bdsetting'});
    },
    async getData(){
      this.comm.loadingShow();
      let datas=await this.SETAPI.LocalIn({'optType':'ReadSetData','pwd':sessionStorage.getItem('bdPwd')});
      if(datas!=null||datas!=undefined){
        let dataArr = datas;
        this.ActivePowerLimitValue=dataArr[12];
      }else{
        this.comm.tipsShow('InvNoResponse');
      }
    },
    onRefresh(){
      this.isLoading = false;
      this.getData();
    }
  },
  mounted(){
    setTimeout(()=>{
      this.getData();
    },1000);
  }
}
</script>

<style scoped lang="less">

</style>
